package com.rp.mqtt;

import cn.hutool.http.HttpRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * 类说明:
 *
 * @author ****
 * @date 2021-04-09 17:33  新建
 */
@Service
public class MqttHttpServiceImpl implements MqttHttpService{

    private static String local = "http://rupeng119.com:18084";

    @Value("${mqtt.username}")
    private String username;

    @Value("${mqtt.password}")
    private String password;

    @Override
    public String getClients() {
        String address = "/api/v4/clients";
        String result2 = HttpRequest.get(local + address)
                //超时，毫秒
                .timeout(20000)
                .basicAuth(username, password)
                .execute().body();
        return result2;
    }

}
